package main

import (
	"fmt"
	"net/http"
	"wx-mp-push-demo/conf"
	"wx-mp-push-demo/util"
)

func main() {
	fmt.Println("config : ", *conf.Config)

	mux := http.NewServeMux()
	mux.HandleFunc("/push", func(writer http.ResponseWriter, request *http.Request) {
		util.PostWxMpTempMessageToAll()
		_, _ = writer.Write([]byte("<h1>成功！</h1>"))
	})

	httpServer := &http.Server{
		Addr:    ":" + conf.Config.HttpServerPort,
		Handler: mux,
	}

	_ = httpServer.ListenAndServe()
}
